﻿using Syncfusion.UI.Xaml.NavigationDrawer;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Syncfusion.Lib.Converters
{
    /// <summary>
    /// 功能列转 NavigationItem ItemType
    /// </summary>
    [ValueConversion(typeof(string), typeof(ItemType))]
    public class FunctionTypeToNavigationItemItemTypeConverter : IValueConverter
    {
        public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
        {
            ItemType res = ItemType.Button;
            string strType = value?.ToString() ?? "";
            switch (strType)
            {
                case "Link":
                case "Button":
                case "Page":
                    res = ItemType.Tab;
                    break;
                case "Directory":
                default:
                    break;
            }
            return res;
        }

        public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
        {
            return "";
        }
    }
}
